package com.alax.interfaces.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.alax.interfaces.interceptor.ApiAuthInterceptor;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    
    @Autowired
    private ApiAuthInterceptor apiAuthInterceptor;
    
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(apiAuthInterceptor)
                .addPathPatterns("/api/**")  // 只拦截API接口
                .excludePathPatterns("/api/auth/**");  // 排除认证相关接口
    }
} 